﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;

namespace 可选参数
{
    internal class Program
    {
        static void Main(string[] args)
        {

            TestMethod(11, 11);
            TestMethod(11);
            Console.WriteLine("----------可选参数-------");
            Class1 testMeyhod = new Class1();
            testMeyhod.TestMethod(1);
            testMeyhod.TestMethod(1,2,3);
            Console.WriteLine("-----------带参数名称------");
            testMeyhod.TestMethod(1,  4);
            testMeyhod.TestMethod(1, opt3:4);

            Console.ReadKey();
        }

        public static void TestMethod(int 非可选参数, int 可选参数 = 42)
        {
            Console.WriteLine(可选参数 + 非可选参数);
        }

       
            


    }
}
